const mongoose = require("mongoose")
const { Schema, model } = mongoose

const PlaysSchema = new Schema({
    id_play: {
        type: Number,
        unique: true,
        required: [true,"需要剧本ID"],
    },
    id_store:{
        type: Schema.Types.ObjectId,
        ref:"Stores",
        required: true
    },
    id_drama:{
        type: Schema.Types.ObjectId,
        ref:"Dramas",
        required: true
    },
    price: {
        type: Number,
        default: 128
    },
    reserves:{
        type: [Schema.Types.ObjectId],
        ref:"Reserves",
    }
    
}, { timestamps: true, versionKey: false })

module.exports = model("Plays", PlaysSchema, "Plays")